package com.hanthink.system.service.impl.repair;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hanthink.system.domain.repair.MyRequestRecordMessage;
import com.hanthink.system.mapper.repair.MyRequestRecordMapper;
import com.hanthink.system.service.repair.IMyRequestRecordService;

@Service
public class IMyRequestRecordServiceImpl implements IMyRequestRecordService {

	@Autowired
	MyRequestRecordMapper myRequestRecordMapper;

	@Override
	public List<MyRequestRecordMessage> SelectRecordMessage(MyRequestRecordMessage myRequestRecordMessage) {
		return myRequestRecordMapper.SelectRecordMessage(myRequestRecordMessage);
	}

	@Override
	public List<MyRequestRecordMessage> SelectCharMessage(MyRequestRecordMessage myRequestRecordMessage) {

		List<MyRequestRecordMessage> list = myRequestRecordMapper.SelectCharMessage(myRequestRecordMessage);
		if (list.size() > 0) {
			// 查询总数量
			List<MyRequestRecordMessage> totalList = myRequestRecordMapper.SelectCharTotalNum(myRequestRecordMessage);
			for (MyRequestRecordMessage record : list) {
				record.setProportion(record.getAmount());
				record.setA(totalList.get(0).getA());
				record.setMemo(record.getName());
			}
		}

		return list;
	}

}
